# 导包
import time
import unittest
from scripts.test01_login import TestLogin
from lib.HTMLTestRunner import HTMLTestRunner

# 封装测试套件
suite = unittest.TestSuite()  # 实例化suite
suite.addTest(unittest.makeSuite(TestLogin))

# 指定报告位置
report = "./report/report-{}.html".format(time.strftime("%Y%m%d-%H%M%S"))

# 以文件流形式打开文件
with open(report, "wb") as f:
    # 创建HTMLTextRunner运行器
    runner = HTMLTestRunner(f, title="tpshop接口测试报告(框架版)")
    # 执行测试套件
    runner.run(suite)